UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yxDZhOBslhWTUyd+J2a8sBazlGJPaIzAgqD6EcbV5VQ=' 
WHERE 
  key_id = '373b32312ad806463dd1fb9bf21c3236f296625f8b0c6c25538459727a844577' 
  AND (
    token = 'yxDZhOBslhWTUyd+J2a8sBazlGJPaIzAgqD6EcbV5VQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034