UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kvDmsEN25m0T3TB8lMrmkOsWALdKoiF23GCpJq+pG+M=' 
WHERE 
  key_id = '838a6849291d7a9c2e84ffeef998a8e667bdaca11a46bcd480d184c2219a0bba' 
  AND (
    token = 'kvDmsEN25m0T3TB8lMrmkOsWALdKoiF23GCpJq+pG+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040