UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o+ctVDR4fa10tnCITuRfHny11SHwXjXl8a68qCC0nFI=' 
WHERE 
  key_id = '7fb554279709eab22e7921908f9d06e23e81ca34b681b0a7bca2595eba58684a' 
  AND (
    token = 'o+ctVDR4fa10tnCITuRfHny11SHwXjXl8a68qCC0nFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037