UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uQyPXVp8z/ORvj7/DJ+xwRSEm5EX3p3tz1uJn0sGw3A=' 
WHERE 
  key_id = '1387f408c0f18ebba77331768486a04fa95fe4ca85b4e0cc19c67238c5c547f4' 
  AND (
    token = 'uQyPXVp8z/ORvj7/DJ+xwRSEm5EX3p3tz1uJn0sGw3A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028