UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7XSjpHCey0AAMPded3b+R0kNlwmdtRVYVrvAqqMSjoI=' 
WHERE 
  key_id = '6db6fbfea42b74a543f7eca8d429e9f46ed6efd83a7ef619b2918c71ea0c9152' 
  AND (
    token = '7XSjpHCey0AAMPded3b+R0kNlwmdtRVYVrvAqqMSjoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032