UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c32nbkiCWgXMPb6NAMChQJHvihzAER+9UKWUjVl3R+I=' 
WHERE 
  key_id = '5fc552ece247631603d9b4baf7d4dd129193e6ab4e0bbd8cc8ffd9c5a02a9b4a' 
  AND (
    token = 'c32nbkiCWgXMPb6NAMChQJHvihzAER+9UKWUjVl3R+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035