UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nkPUq9ChvatNslLeoMlluwx74tumbe++jiDmy/85Cs0=' 
WHERE 
  key_id = '12caa91e372cbeea52b8305e4a36b93ab42001e3d508eb7a9a0dad17174c4f8d' 
  AND (
    token = 'nkPUq9ChvatNslLeoMlluwx74tumbe++jiDmy/85Cs0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020