UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sw5yiBBMFGsngbdGDb1iwPt3Y7YMVq5WnhiQiFgDiII=' 
WHERE 
  key_id = 'b3fd0dc747df726581558af362c8049e891089354aa00c7133ca2fb8c9d0386f' 
  AND (
    token = 'sw5yiBBMFGsngbdGDb1iwPt3Y7YMVq5WnhiQiFgDiII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026