UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KVuhIdhO9M6iPA/5K4YMuX0lXi+wi2mxp9WCmfwidTM=' 
WHERE 
  key_id = '643d1ba9bc1472dae9d6efbf77ef6bfe706ba0d89ba5d77dfa626b18efa1660a' 
  AND (
    token = 'KVuhIdhO9M6iPA/5K4YMuX0lXi+wi2mxp9WCmfwidTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048