UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AHwUPEtMxcgIyiBHwcCFwr2GiRr5EA+d5QGUtSdzNtQ=' 
WHERE 
  key_id = '3ff2483a5ec8ce0387278de9a84c4405b3739d26e5a657e059c61e684d0d47c6' 
  AND (
    token = 'AHwUPEtMxcgIyiBHwcCFwr2GiRr5EA+d5QGUtSdzNtQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023