UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XHtevITBySdl4hjzCP//adMEHuaG2p7QknQ5NUiXhho=' 
WHERE 
  key_id = '4051a2a3d9a7009d66078ae297649eb89950a96e93382451b122caf363ea35d1' 
  AND (
    token = 'XHtevITBySdl4hjzCP//adMEHuaG2p7QknQ5NUiXhho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037