UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dgpFO8nSZouZryzAQDE++PxExs4TV6VgKhworE2GY6g=' 
WHERE 
  key_id = '2f3803bbb37132060c749be88c06b25c9718a6d2e2cce51cbdcec650160a0583' 
  AND (
    token = 'dgpFO8nSZouZryzAQDE++PxExs4TV6VgKhworE2GY6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031