UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ExKYU8MHRXSUNeuFzKCExCRrAHF1PbdJOgHYer2Z0BU=' 
WHERE 
  key_id = '95eda339983c6841c1131d03f1264bc6febf6ea1990e19756d9e61ced704f068' 
  AND (
    token = 'ExKYU8MHRXSUNeuFzKCExCRrAHF1PbdJOgHYer2Z0BU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056