UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hpveYdTLToun0r5wfjOaNR2IkONyK915nmI92bvsd+0=' 
WHERE 
  key_id = '3be4202007d3d2972e051b852e62299c89ebf4c6f974ee14740674da7abf067e' 
  AND (
    token = 'hpveYdTLToun0r5wfjOaNR2IkONyK915nmI92bvsd+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047