UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CPFev+WytUL3eseKNFWEPOxjhlhuWZlleVCcT9WU8q8=' 
WHERE 
  key_id = '801814c18eadb35f27aebe979a63721bdef18ae4f98bf0c847c4217fcd18d12b' 
  AND (
    token = 'CPFev+WytUL3eseKNFWEPOxjhlhuWZlleVCcT9WU8q8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024