UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sweu/IjatTFC1ZUcWaUBEbOxvKzkwwXAqWbYpMFAtiw=' 
WHERE 
  key_id = '3bf832360f9ea6c06141c917b0e209ce398e54b67a7cbc63c285d971622bf9fa' 
  AND (
    token = 'sweu/IjatTFC1ZUcWaUBEbOxvKzkwwXAqWbYpMFAtiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029