UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O3hQWzVB1o42hIb4Ec/Zz3kN8yUAL+4QYS6WqtSbyBE=' 
WHERE 
  key_id = 'b882629fe0412c296ffdd205d106dd302d00073319df66f8b80f6faea555b915' 
  AND (
    token = 'O3hQWzVB1o42hIb4Ec/Zz3kN8yUAL+4QYS6WqtSbyBE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025