UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oFfVeAd62XHdRCvGdA9RYSz84LPe/82yig/NdzjwgU4=' 
WHERE 
  key_id = '159c3beada92a0910c9d4074ccbc5ed3a46201f5cfc33d5ef92b1c23cd8dc8b3' 
  AND (
    token = 'oFfVeAd62XHdRCvGdA9RYSz84LPe/82yig/NdzjwgU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036