UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FccppgYWNLVRWvdWaLI93J9J+mH1cjEWemboDcI4LpM=' 
WHERE 
  key_id = '20d6df0d82a8728054e5ebd8f3fa7f643f89629c776f1bedcc77fdd39d5aaa5b' 
  AND (
    token = 'FccppgYWNLVRWvdWaLI93J9J+mH1cjEWemboDcI4LpM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071