UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RPdyqyRi9N9seb94wmVCmNkiPelJCOU88GZOK5UBCQk=' 
WHERE 
  key_id = '7585f3baf8893fd833280c131cb6953d154f88ae7cda8b6b0916ef04a13b6732' 
  AND (
    token = 'RPdyqyRi9N9seb94wmVCmNkiPelJCOU88GZOK5UBCQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053