UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cEsAD/NPRllh/kPR0MlEOzCNiB0sxFBdbOK53PFOkW4=' 
WHERE 
  key_id = 'deb7d7ac11cba284f71ede421a8d824d684a8f5ad6d4ee442daa8bb61098a774' 
  AND (
    token = 'cEsAD/NPRllh/kPR0MlEOzCNiB0sxFBdbOK53PFOkW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032