UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lz/TgNDw3GqLKKMq694mQ1xM0q9lUb5HXY7mFjUsAzU=' 
WHERE 
  key_id = 'f209bd6f0f788f4e368a8972acbbe9559f82ee3e4effa004299d218078ff88f0' 
  AND (
    token = 'lz/TgNDw3GqLKKMq694mQ1xM0q9lUb5HXY7mFjUsAzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056