UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p2WHIXbgYOUIFQh2GUkqUuDdNUuHgpFOTnc+Y7meu2g=' 
WHERE 
  key_id = '9f1efbc87f128c66acd5baeba9a1cb268472178f21ce3c6e5faa207880acb3e9' 
  AND (
    token = 'p2WHIXbgYOUIFQh2GUkqUuDdNUuHgpFOTnc+Y7meu2g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043