UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7ySXSpVLqTGr63uWA+P2rPPBwH/JV3A6z15J60CMWMU=' 
WHERE 
  key_id = '0c7d585886193d4dafb85bfe19e0ea2864437e46d1c392408aaaba9fdffd1f9b' 
  AND (
    token = '7ySXSpVLqTGr63uWA+P2rPPBwH/JV3A6z15J60CMWMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037