UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RdHvFVEaqUw8zbTk7TFcfCQeGDVNKYIvZ7RdSxYd6bU=' 
WHERE 
  key_id = '7bb654aed21b43babc6a4fa06a51c90ec14a56440f45b81b7ad1880db3bb8237' 
  AND (
    token = 'RdHvFVEaqUw8zbTk7TFcfCQeGDVNKYIvZ7RdSxYd6bU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030