UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wFj7MMzZFVI+ANoherJ37g42RAXKNWlq1sZeCYJWCso=' 
WHERE 
  key_id = '9cefdadaf6ac50592673371081f33c90b05ecf7e418afd386056ed0a9881f18d' 
  AND (
    token = 'wFj7MMzZFVI+ANoherJ37g42RAXKNWlq1sZeCYJWCso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032