UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+BQOeMr67wPRXzRvyU9kBz8EMjc4uy5sUxPzlj4SSnQ=' 
WHERE 
  key_id = '4d123dd328e120be512062edb8d4e853a090a73ecd76539db91c999316f835e0' 
  AND (
    token = '+BQOeMr67wPRXzRvyU9kBz8EMjc4uy5sUxPzlj4SSnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054