UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w8ozLLPMZMNqcNJB7X5Z4Y8wIp5NZz8FmMoWQrI2Knk=' 
WHERE 
  key_id = '0f101d337e585c8c6a741fa231e5602325bd4d15998b7b53121ceb2f63a086f0' 
  AND (
    token = 'w8ozLLPMZMNqcNJB7X5Z4Y8wIp5NZz8FmMoWQrI2Knk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029