UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WUt+ZqA69tmnQc2Y/FFe15pvmgo6TXqVLFjMm6iAsPo=' 
WHERE 
  key_id = 'fe0f6e736185306a91a62a5b5f44aab1825c43d7d85e0cd5459b95b5d546161c' 
  AND (
    token = 'WUt+ZqA69tmnQc2Y/FFe15pvmgo6TXqVLFjMm6iAsPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040