UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YN0McFoL20Poz4X56Au+kviPhm0z34UQeyMy6Qy8oCk=' 
WHERE 
  key_id = '1b9f4eff4f058aee895b55186aeb040c10daea9409fd9151bb6f99e04424870f' 
  AND (
    token = 'YN0McFoL20Poz4X56Au+kviPhm0z34UQeyMy6Qy8oCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036