UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5tpYtfVEsVf9TnZVgita4cdrsGeBHEBxPfS3NMzRn3Y=' 
WHERE 
  key_id = 'cbca32d7007d4599fc7d5bd6652faf8f46fcf231fe350874b9237d1bc7a902f4' 
  AND (
    token = '5tpYtfVEsVf9TnZVgita4cdrsGeBHEBxPfS3NMzRn3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035