UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BCtrmjRwZKjh5NpXk7f9CpOLGY+x988xxDcH6Km4TCE=' 
WHERE 
  key_id = '449f0902f9bc0c18fb0b82e59f38cde5d62d677fc9c8d13e5d17b9e6d0df685d' 
  AND (
    token = 'BCtrmjRwZKjh5NpXk7f9CpOLGY+x988xxDcH6Km4TCE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041