UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MmaXhyXnRI6pJ2SSC3V/2CtMLHgUGXnLUWJagacrMkA=' 
WHERE 
  key_id = '840e80665605e40d2e077ce9b2190a0562169d7cd24543fa22dd2b3a212a4be3' 
  AND (
    token = 'MmaXhyXnRI6pJ2SSC3V/2CtMLHgUGXnLUWJagacrMkA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030