UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZCEwKcnya3Vsr3YC3AO631J2VnYoaV5y1q7rkajPpFg=' 
WHERE 
  key_id = 'fad71bfa726efb7f15d7d6de3264ff99e18de3d437a4ab067a557e24d0ebee93' 
  AND (
    token = 'ZCEwKcnya3Vsr3YC3AO631J2VnYoaV5y1q7rkajPpFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035