UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Eznj7P+OFKH0ABkpxCeA++bHrBs6bJ814BqufUwBj70=' 
WHERE 
  key_id = '31cf78f54c92b740b51c04fb5a4ecd98db6e0ef1c752e9ad6c75b84465753ce0' 
  AND (
    token = 'Eznj7P+OFKH0ABkpxCeA++bHrBs6bJ814BqufUwBj70=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038