UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iVcMtSocdR+1ACM17i9Sdbn4jvjLH75HvR95e/Nt7HM=' 
WHERE 
  key_id = '65d2a342173f154a5b77ca49435363b74b0372ddcef434b20652c7d91938bb1a' 
  AND (
    token = 'iVcMtSocdR+1ACM17i9Sdbn4jvjLH75HvR95e/Nt7HM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031