UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4r+dJ0wcWxbccAqrB+ixBQ8GZSFyo98Ygozw1vNRHho=' 
WHERE 
  key_id = '2220aa528e66c077701e1dc64f42aec64a00c9da93aa9194f3631fa37336552b' 
  AND (
    token = '4r+dJ0wcWxbccAqrB+ixBQ8GZSFyo98Ygozw1vNRHho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050