UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bbMHYdNCGixcqrbEnB6hLNpcULucSTwFMOOiAq1z0g4=' 
WHERE 
  key_id = '17ec9919970a0144c659fe4a778ea0ef10ca8ac7cacb17c0f8fc5beb61873801' 
  AND (
    token = 'bbMHYdNCGixcqrbEnB6hLNpcULucSTwFMOOiAq1z0g4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027