UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3DkGAdmu1JfOxYRcHL24jRvecirDmoakGwNELDoWx+U=' 
WHERE 
  key_id = 'ee26bd7988a58856b856a4d8437c14bacd8eee827bdba78783b781ff556b5141' 
  AND (
    token = '3DkGAdmu1JfOxYRcHL24jRvecirDmoakGwNELDoWx+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022