UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QiSNgrtYNJmTFexre/K6wZAJrCFriA4CmedaYpG/1YY=' 
WHERE 
  key_id = '2e1353df6ba7fda3567e3bd22549257fa6b2b6a295b8a4424f5c7a56c1557651' 
  AND (
    token = 'QiSNgrtYNJmTFexre/K6wZAJrCFriA4CmedaYpG/1YY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020