UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IcGCbJo3VitKlT6VxJKqxtRcAQJGTbYpZyb+d4OTwwU=' 
WHERE 
  key_id = '2d3871f7c8f1c3935036bc9beda7e7af738b2f1a8c08ca8b619304be249c5644' 
  AND (
    token = 'IcGCbJo3VitKlT6VxJKqxtRcAQJGTbYpZyb+d4OTwwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043