UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vidhCNZCYukQ8F0/+XUsd4Zwj4ojLlCexueG5UOkito=' 
WHERE 
  key_id = 'bf421f923f405efdaaaf9468a73dbaf5700e40a0e9fa3fccdaede1dd45774a5d' 
  AND (
    token = 'vidhCNZCYukQ8F0/+XUsd4Zwj4ojLlCexueG5UOkito=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045