UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J1JXaXXS46gQ6HmMFbjOtlTMdaLihnyDQ+MozxJhQ0w=' 
WHERE 
  key_id = '6fc2a962d001ebdb323b88d482fbda36a585c5d038ee807781a6289f76ff02f3' 
  AND (
    token = 'J1JXaXXS46gQ6HmMFbjOtlTMdaLihnyDQ+MozxJhQ0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021