UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ewt/Vydl066KjcPy8A1zVqw9dCDrPgWZ1QOME+C7bE4=' 
WHERE 
  key_id = '2c94120ecabc032c1da6200e06f24ef460bd37cad4dde125e7abafb8a5c61437' 
  AND (
    token = 'Ewt/Vydl066KjcPy8A1zVqw9dCDrPgWZ1QOME+C7bE4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053